<?=use_lightbox()?>
<script language='javascript' type='text/javascript' src="<?=base_url('get_images')?>scripts/get_image.js"></script>

<script language='javascript' type='text/javascript' src="<?=base_url('news')?>scripts/news.js"></script>
<?php echo form_open($this->news_detail_model->url_prefix); ?>
<?if($msg){?><center><div class="messageBox"><?=$msg?></div></center><?}?>
<table border="0" cellspacing="0" cellpadding="0" class="infoTable">
  <tr>
    <td id='infoStr'>Tiêu đề *:</td>
    <td id='infoInput' align='left'><input name="title" id="title" type="text" value="<?=h($title)?>" size="30" /></td>
  </tr>
  
  <tr>
    <td id='infoStr'>Image :</td>
    <td id='infoInput' align='left'>
    	<input value='{imagepath}' name="imagepath" id="imagepath" size="60" maxlength="255" /><a href="<?=base_url()?>admin_ajax/get_images.get_images/" rel="ibox&height=450"><input type="button" value="Browse" /></a><input type="button" value="remove" class="cancel_button" onclick="removeimage();" /><?=form_error('imagepath');?><br>
    	<img name="image_url" id="image_url" src="<?=base_url()?>application/assets/admin/images/non.jpg" align="top" />   
			
    	<input type="hidden" value='{imagejson}' name="imagejson" id="imagejson" />
		<script language="javascript">
			try {
				var obj = '<?=$imagejson?>'.evalJSON();
				get_image.toImageFromObject('image_url', obj);
			}
			
			catch ( e ) {					
			} 
			
			
			get_image.onClicked = function(obj){
				obj.toImage('image_url');	
				$('imagejson').value = Object.toJSON(obj);
				$('imagepath').value = obj.path;
			};
			
			function removeimage(){
				var r = confirm('Are you sure to remove this image');
				if(r){
					$('image_url').src = "<?=base_url()?>application/assets/admin/images/non.jpg";
					$('image_url').removeAttribute('width');
					$('image_url').removeAttribute('height');
					$('image_url').removeAttribute('vspace');
					$('image_url').removeAttribute('hspace');
					$('image_url').removeAttribute('border');
					$('image_url').removeAttribute('align');
					$('image_url').removeAttribute('alt');
					$('imagepath').value = "";
					$('imagejson').value = "";
				}
			} 
		</script>		
    </td>
  </tr>
  
  <tr>
    <td id='infoStr'>Nhóm tin *:</td>
    <td id='infoInput' align='left'>
	<select name="topic" id="topic">
	<?$i=1;foreach($topics as $o_topic){?>
	 <option value="<?=$o_topic->{TOPIC_ID}?>" <? if($o_topic->{TOPIC_ID}==$topic) echo 'selected'; ?>><?=$o_topic->{TOPIC_NAME}?></option>
	<?}?>
	</select>
  </tr>
  <tr>
    <td id='infoStr'>Tin tóm tắt:</td>
    <td id='infoInput' align='left'>{review}</td>
  </tr>
  <tr>
    <td id='infoStr'>Nội dung tin:</td>
    <td id='infoInput' align='left'>{description}</td>
  </tr>
  <tr>
    <td id='infoStr'>Hiển thị:</td>
    <td id='infoInput' align='left'><input name="active" type="checkbox"{active} /></td>
  </tr>
  <tr>
    <td id='infoStr'>&nbsp;</td>
    <td id='infoInput' align='left'>
        <input type="button" value="Lưu" class="save_button" style="cursor:pointer" onclick="return news.saveItem({start}, {item}, '{language}')" />&nbsp;
        <input type="button" value="Quay về" class="cancel_button" style="cursor:pointer" onclick="news.cancel({start}, '{language}')" />
    </td>
  </tr>
</table>
</form>